﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Input;

namespace InkRun
{
    class InkWave : GameObject
    {

        public static Texture2D InkWaveSprite { get; set; }
        public float scale;
        public bool touchingOtherInkWave;
        public enum InkWaveState
        {
            Alive,
            Dead
        }

        /// <summary>
        /// The unique ID of the InkWave
        /// </summary>
        public int InkWaveID { get; set; }

        public InkWaveState inkWaveState;

        new public Vector2 velocity;



        public float timeTillNextShot;

        public int upKey, downKey, leftKey, rightKey, fireKey;
        public Color color;


        public int Lives { get; set; }
        public bool NoLivesLeft { get; set; }

        public InkWave(Vector2 position)
            : base(position)
        {

            scale = 2.0f;
            sizeInPixels = new Vector2(scale * InkWaveSprite.Bounds.Width, scale * InkWaveSprite.Bounds.Height);
            inkWaveState = InkWaveState.Alive;
            velocity = new Vector2(1.0f, 0.0f);
            SetUpInkWave();
        }

        public InkWave(int InkWaveID, Vector2 Position)
            : base(Position)
        {
            this.InkWaveID = InkWaveID;
            touchingOtherInkWave = false;

            // Lives

            Lives = 3;
            NoLivesLeft = false;
        }

        public void SetUpInkWave()
        {
        }

        public void ResetInkWave()
        {

        }

        public override void Update(GameTime gameTime)
        {

            float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            switch (inkWaveState)
            {
                case InkWaveState.Alive:
                    position += velocity;

                    break;
                case InkWaveState.Dead:

                    break;
                default:
                    break;
            }
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            switch (inkWaveState)
            {
                case InkWaveState.Alive:
                    spriteBatch.Draw(InkWaveSprite, position, null, Color.White, 0, new Vector2(InkWaveSprite.Bounds.Center.X, InkWaveSprite.Bounds.Center.Y), scale, SpriteEffects.None, 0);

                    break;
                case InkWaveState.Dead:

                    break;
                default:
                    break;
            }
        }

        public override void Die()
        {
            base.Die();
        }
    }
}
